<%@ page language="java" contentType="text/html; charset=UTF-8"	pageEncoding="UTF-8" isELIgnored="false"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib  prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="chtml" uri="http://www.szhelper.com/jsp/html"%>
<%@ page import="java.util.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh-CN" lang="zh-CN">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<title>${links.id == null?"新增":"修改"}友情链接</title>
		<chtml:script src="/js/ajaxfileupload.js" />
		<script type="text/javascript">
			function onsubmits(){
				return true;
			}
			function deleteImg(){
				$("input[name^=logo]").val("");
				$("img[name^=imgLogo]").attr("src", "");
				$("img[name^=imgLogo]").css("display", "none");
			}
			function uploadImg(){
				var path = document.getElementById("uploadLogo").value;
				if(!path) {
					alert("您必须选择要上传的文件!");
					return;
				}
				upload();
			}
			function upload(){
				$.ajaxFileUpload({
					url:'<chtml:path path="/" />links/upload',            //需要链接到服务器地址
					secureuri:false,
					fileElementId:'uploadLogo',                     //文件选择框的id属性
					dataType: 'json',                           //服务器返回的格式
					success: function (data, status){//相当于java中try语句块的用法
						alert(data.msg);
						if(data.imgurl){
							$("input[name^=logo]").val(data.imgurl);
							$("img[name^=imgLogo]").attr("src", data.imgurl+"?"+new Date().getTime());
							$("img[name^=imgLogo]").css("display", "");
						}
					},
					error: function (data, status, e){//相当于java中catch语句块的用法
						alert(data.msg);
						return;
					}
				});
			}
		</script>
	</head>
	<body>
	<div class="youarehere">系统管理 &gt; <span>管理友情链接</span>&gt; <span>${links.id == null?'新增':'修改'}友情链接</span></div>
		<chtml:command command="links" title="${links.id == null?'新增':'修改'}" action="/links/${links.id == null?'save':'update'}" method="POST" exclude="logo,lastUpdateTime,operator,isPass,checker" onSubmit="onsubmits()">
			<chtml:property index="6" label="网站LOGO">
				<input name="logo" value="${links.logo}" id="" type="hidden" />
				<img name="imgLogo" width="88" height="31" style="vertical-align:middle;display:none;" src="${links.logo}" />
				<span>(图标大小：88*31，格式：gif或jpg)</span>
				<input type="button" onclick="javascript:deleteImg();" id="deleteLogoBtn" value="删除" title="删除"/>
			</chtml:property>
			<chtml:property index="6" label="上传LOGO">
				<iframe id="upfileFrame" name="upfileFrame" style="display: none;"></iframe>
				<input name="uploadLogo" value="" id="uploadLogo" type="file" onkeydown="return false" />
				<input type="button" class="pub_bt" onclick="javascript:uploadImg();" id="uploadLogoBtn" value="上传" title="上传"/>
			</chtml:property>
			<chtml:property index="11" label="更新时间">
				<input name="lastUpdateTimeTemp" type="text" style="border:0;background:none" readonly="readonly" value="<fmt:formatDate value='${links.lastUpdateTime}' pattern='yyyy-MM-dd HH:mm' />" />
			</chtml:property>
			<chtml:property index="11" label="更新人">
				<input name="operatorTemp" type="text" style="border:0;background:none" readonly="readonly" value="${CUR_USER_INFO.realName}" />
			</chtml:property>
			<chtml:button destination="/links/${links.id == null?'save':'update'}" showText="${links.id == null?'新增':'修改'}"></chtml:button>
		</chtml:command>
		<!--说明   -->	
<div class="sm_info">
	<p class="row_one">说明：</p>
	<p class="other"></p>
	<p class="other"></p>
</div>
<style type="text/css">
td.data_tab_tdl #type{
font: 12px Tahoma;
padding: 2px 6px;
margin: 0 5px 0 8px;
height: 18px;
width: 18px;
}
</style>
		
	</body>
</html>


